<div class="content-wrapper">
    <section class="content-header">
        <h1>
            三级分类
        </h1>
        <ol class="breadcrumb">
            <li><a href="/admin"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">系统配置</li>
            <li class="active">三级分类</li>
        </ol>
    </section>
    <section class="content">
        <div class="box">
            <div class="box-header with-border">
                <form class="form-inline" action="/admin/itemCate/cateList3" method="get">
                    <div class="form-group">
                        <label for="name">名称 </label>
                        <input type="text" class="form-control" id="name" name="name" placeholder="名称" value="{$name}">
                    </div>
                    <div class="form-group">
                        <label for="status">状态 </label>
                        <select class="form-control" id="status" name="status">
                            <option value="0">请选择</option>
                            <option value="1" <if condition="$status eq 1">selected</if>>正常</option>
                            <option value="-1" <if condition="$status eq -1">selected</if>>已关闭</option>
                        </select>
                    </div>
                    <button type="submit" class="btn btn-info" id="save-btn">查询</button>&nbsp;
                    <button type="button" class="btn btn-danger" onclick="window.location.href='/admin/itemCate/editCate3';">添加</button>
                </form>
            </div>
            <div class="box-body">
                <table class="table table-bordered">
                    <tbody>
                    <tr>
                        <th style="width: 40px">ID</th>
                        <th>三级分类</th>
                        <th>状态</th>
                        <th>时间</th>
                        <th style="width: 320px">操作</th>
                    </tr>

                    <foreach name="cateList" item="cate">
                        <tr>
                            <td>{$cate.id}</td>
                            <td>{$cate.name}</td>
                            <td><if condition="$cate.status eq 1">正常<else/><span style="color:red;">已关闭</span></if></td>
                            <td>{$cate.create_time}</php></td>
                            <td>&nbsp;
                                <button class="btn btn-primary btn-xs" type="button" onclick="window.location.href='/admin/itemCate/editCate3?id={$cate.id}'">编辑</button>&nbsp;
                                <button class="btn btn-danger btn-xs btn-delete" type="button" data-id="{$cate.id}">删除</button>&nbsp;
                            </td>
                        </tr>
                    </foreach>

                    </tbody>
                </table>
            </div>
            <div class="box-footer clearfix">{$page_html}</div>
        </div>
    </section>
</div>
<script type="application/javascript">
    $('.btn-delete').click(function () {
        var id = $(this).attr('data-id');
        ArtDialogHlp.showConfirm('提示',"确认删除该分类吗",function () {
            $.post('/admin/itemCate/deleteCate',
                {
                    id : id,
                    status : -5
                }, function(data){
                    if(data.Code == 999) {
                        ArtDialogHlp.showInfo('提示', '操作成功', function(){
                            window.location.href = '/admin/ItemCate/cateList';
                        });
                    } else {
                        ArtDialogHlp.showInfo('提示', data.Msg);
                    }
                }, 'json');
        });
    });
</script>